<template>
  <view class="recharge-rule">
    <Form ref="rechargeForm" :model="formData" :rules="rules">
      <FormItem label="转入金额">
        <input type="number" v-model.number="formData.amount" placeholder="请输入转入金额" />
      </FormItem>
      <FormItem label="赠送金额">
        <input type="number" v-model.number="formData.give" placeholder="请输入赠送金额" />
      </FormItem>
    </Form>
    <SaveButton @click="submit"></SaveButton>
  </view>
</template>

<script>
import Form from "../../components/public/Form/index.vue";
import FormItem from "../../components/public/FormItem/index.vue";
import SaveButton from "../../components/public/Button/SaveButton.vue";
export default {
  components: {
    Form,
    FormItem,
    SaveButton
  },
  data() {
    return {
      formData: {
        amount: "", //充值金额
        give: "" // 赠送金额
      },
      rules: {
        amount: [
          { required: true, message: "请填写充值金额" },
          { type: "number", message: "请输入正确的金额" }
        ],
        give: [
          { required: true, message: "请填写赠送金额" },
          { type: "number", message: "请输入正确的金额" }
        ]
      }
    };
  },
  methods: {
    submit() {
      this.$refs.rechargeForm.validate(valid => {
        if (valid) {
        } else {
        }
      });
    }
  }
};
</script>

<style lang="scss">
.recharge-rule {
}
</style>
